#include "mtrr.h"
/* No blocking mutexes in Xen. Spin instead. */
-#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
+#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m)
#define down(_m) spin_lock(_m)
#define up(_m) spin_unlock(_m)
#define lock_cpu_hotplug() ((void)0)
/*
* Initializes the POOL of ASID used by the guests per core.
*/
-void asidpool_init( int core )
+void asidpool_init(int core)
{
int i;
- svm_globals[core].ASIDpool.asid_lock = SPIN_LOCK_UNLOCKED;
- spin_lock(&svm_globals[core].ASIDpool.asid_lock);
+
+ spin_lock_init(&svm_globals[core].ASIDpool.asid_lock);
+
/* Host ASID is always in use */
svm_globals[core].ASIDpool.asid[INITIAL_ASID] = ASID_INUSE;
- for( i=1; i<ASID_MAX; i++ )
- {
+ for ( i = 1; i < ASID_MAX; i++ )
svm_globals[core].ASIDpool.asid[i] = ASID_AVAILABLE;
- }
- spin_unlock(&svm_globals[core].ASIDpool.asid_lock);
}
/* internal function to get the next available ASID */
-static int asidpool_fetch_next( struct vmcb_struct *vmcb, int core )
+static int asidpool_fetch_next(struct vmcb_struct *vmcb, int core)
{
int i;
- for( i = 1; i < ASID_MAX; i++ )
+ for ( i = 1; i < ASID_MAX; i++ )
{
- if( svm_globals[core].ASIDpool.asid[i] == ASID_AVAILABLE )
+ if ( svm_globals[core].ASIDpool.asid[i] == ASID_AVAILABLE )
{
vmcb->guest_asid = i;
svm_globals[core].ASIDpool.asid[i] = ASID_INUSE;
* moves to arch independent land
*/
-spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(i8259A_lock);
static void disable_8259A_vector(unsigned int vector)
{
#include <asm/processor.h>
#define pr_debug(x...) ((void)0)
-#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED
+#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m)
#define down(_m) spin_lock(_m)
#define up(_m) spin_unlock(_m)
#define vmalloc(_s) xmalloc_bytes(_s)
local_irq_restore(flags);
}
-static spinlock_t flush_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(flush_lock);
static cpumask_t flush_cpumask;
static unsigned long flush_va;
unsigned long cpu_khz; /* CPU clock frequency in kHz. */
unsigned long hpet_address;
-spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(rtc_lock);
unsigned long volatile jiffies;
static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */
-static spinlock_t wc_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(wc_lock);
struct time_scale {
int shift;
static s_time_t stime_platform_stamp;
static u64 platform_timer_stamp;
static struct time_scale platform_timer_scale;
-static spinlock_t platform_timer_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(platform_timer_lock);
static u64 (*read_platform_count)(void);
/*
static unsigned long inuse[BITS_TO_LONGS(GLOBALMAP_BITS)];
static unsigned long garbage[BITS_TO_LONGS(GLOBALMAP_BITS)];
static unsigned int inuse_cursor;
-static spinlock_t globalmap_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(globalmap_lock);
void *map_domain_page_global(unsigned long pfn)
{
long ret = 0;
struct dom0_op curop, *op = &curop;
void *ssid = NULL; /* save security ptr between pre and post/fail hooks */
- static spinlock_t dom0_lock = SPIN_LOCK_UNLOCKED;
+ static DEFINE_SPINLOCK(dom0_lock);
if ( !IS_PRIV(current->domain) )
return -EPERM;
#define round_pgdown(_p) ((_p)&PAGE_MASK)
#define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
-static spinlock_t page_scrub_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(page_scrub_lock);
LIST_HEAD(page_scrub_list);
/*********************
static unsigned long avail[NR_ZONES];
-static spinlock_t heap_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(heap_lock);
void end_boot_allocator(void)
{
/* Dom0 control of perf counters */
int perfc_control(dom0_perfccontrol_t *pc)
{
- static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+ static DEFINE_SPINLOCK(lock);
u32 op = pc->op;
int rc;
*/
int tb_control(dom0_tbufcontrol_t *tbc)
{
- static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+ static DEFINE_SPINLOCK(lock);
int rc = 0;
spin_lock(&lock);
#include <xen/prefetch.h>
static LIST_HEAD(freelist);
-static spinlock_t freelist_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(freelist_lock);
struct xmalloc_hdr
{
static int sercon_handle = -1;
static int vgacon_enabled = 0;
-spinlock_t console_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(console_lock);
/*
* *******************************************************
static unsigned int debugtrace_prd; /* Producer index */
static unsigned int debugtrace_kilobytes = 128, debugtrace_bytes;
static unsigned int debugtrace_used;
-static spinlock_t debugtrace_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(debugtrace_lock);
integer_param("debugtrace", debugtrace_kilobytes);
void debugtrace_dump(void)
va_list args;
char buf[128];
unsigned long flags;
- static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+ static DEFINE_SPINLOCK(lock);
extern void machine_restart(char *);
debugtrace_dump();
#include <xen/spinlock.h>
#include <xen/guest_access.h>
-extern spinlock_t console_lock;
-
void set_printk_prefix(const char *prefix);
long read_console_ring(XEN_GUEST_HANDLE(char), u32 *, int);